package com.wanwanbear.www.controller;

import com.wanwanbear.www.service.UploadFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * Created by wz on 2017/6/26.
 */
@Controller
public class UploadController {
    @Autowired
    UploadFile uploadFile;

    @RequestMapping(value = "/upload",method = RequestMethod.POST)
    @ResponseBody
    public boolean UploadFileByWeb(@RequestParam("upload") MultipartFile upload){
        System.out.println(upload.getContentType());
        boolean b = uploadFile.upload(upload);
        return b;
    }
}
